package com.xy.shardingjdbcdemo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xy.shardingjdbcdemo.domain.OrderItem;
import com.xy.shardingjdbcdemo.domain.OrderVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author xy
* @description 针对表【t_order_item】的数据库操作Mapper
* @createDate 2024-01-02 15:36:28
* @Entity com.xy.shardingjdbcdemo.domain.OrderItem
*/
public interface OrderItemMapper extends BaseMapper<OrderItem> {

    @Select("SELECT o.order_no orderNo,SUM(i.price * i.count) as amount " +
            "from t_order o JOIN t_order_item i " +
            "ON o.order_no = i.order_no GROUP BY o.order_no ORDER BY o.order_no desc")
    List<OrderVO> selectList();

}




